<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button>1</button>
		<button>2</button>
		<button>3</button>
		<button>4</button>
		<button>5</button>
		
		<script type="text/javascript">
			var btns = document.getElementsByTagName('button')
			for (var i =0; i<btns.length; i++) {
				btns[i].onclick = function () {
					for (var j = 0; j<btns.length; j++) {
						btns[j].style.background = 'none'
					}
					this.style.background = 'red'
				}
			}
		</script>
	</body>
</html>
